package socket

import (
	"fmt"
	"jwgin/service"
	"net/http"
)

func WsRouter() error {
	hub := newHub()
	go hub.run()
	http.HandleFunc("/data", func(w http.ResponseWriter, r *http.Request) {
		serveWs(hub, w, r)
	})
	return http.ListenAndServe(fmt.Sprintf(":%v", service.Conf.System.WsAddr), nil)
}
